export default {
	showToast(title,icon = 'none',duration = 1500){
		uni.showToast({
			icon:icon,
			title:title,
			duration:duration
		})
	},
	async userJian(){
		let userInfo = uni.getStorageSync('userInfo');
		if(userInfo.group_id == 2 || userInfo.group_id == 4){
			return true
		}else {
			return false
		}
	},
	async navTo(url){
		uni.navigateTo({
			url:`/pages/${url}`,
			fail(e) {
				this.showToast(JSON.stringify(e))
			}
		})
	},
	async switchTo(url){
		uni.switchTab({
			url:`/pages/${url}`,
			fail(e) {
				this.showToast(JSON.stringify(e))
			}
		})
	},
	async redTo(url){
		uni.redirectTo({
			url:`/pages/${url}`,
			fail(e) {
				this.showToast(JSON.stringify(e))
			}
		})
	},
	async setredTo(url){
		setTimeout(() => {
			uni.redirectTo({
				url:`/pages/${url}`
			})
		},1500)
	},
	navBack(){
		uni.navigateBack()
	},
	navBackTo(){
		setTimeout(() => {
			uni.navigateBack()
		},1500)
	},
	to_timeStemp(timeStemp,type=1){
		let nDate = new Date(timeStemp);
		let nY = nDate.getFullYear(),
			nM = nDate.getMonth() + 1,
			nD = nDate.getDate(),
			nH = nDate.getHours(),
			nS = nDate.getMinutes(),
			mm = nDate.getSeconds();
		if(type == 1){
			return `${nY}-${nM}-${nD} ${nH}:${nS}:${mm}`
		}else {
			return `${nY}-${nM}-${nD}`
		}
	},
	showModels(con){
		uni.showModal({
			content:con
		})
	}
}